<template>
  <div id="app">
    <div class="load" v-if="isload">
      <div class="title">WorkTodos📚📕</div>
      <div class="version">v1.0.0</div>
      <Loads></Loads>
      <div class="text">
          加载中...
      </div>
    </div> 
    <router-view v-if="!isload"></router-view>
  </div>
</template> 
<script>
import Loads from '@/components/loading.vue'
  export default {
    name: 'my-project',
    components:{
      Loads
    },
    data(){
       return{
           isload:true,
           datas:'',
       }
    },
    provide:function () {
        return {
           name:()=>this.datas
        }
    },
    mounted(){
         // 数据
      let _this = this;
      if(window.ipcRenderer){
        window.ipcRenderer.on('createdom',(e,res)=>{
            console.log(res,e);
            _this.isload = false;
            _this.datas = res==''?{}:res;  
        })
        // 字体
        var myFonts = new FontFace('myFontName', 'url(fonts.ttf)',{});
        myFonts.load().then(function(loadFace){ 
          document.fonts.add(loadFace);
        });
      }else{
        _this.isload = false;
        _this.datas = {};  
      }
    
   
    },
  }
</script> 
<style lang="less">
 
.load{
    width: 40%;
    margin: 0 auto;
    height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border-radius: 5px;
    font-family:century gothic, texgyreadventor, stheiti, sans-serif;
    .title{
      font-size: 1.2rem;
      font-weight: bold;
      margin-bottom: .5rem;
      
    }
    .version{
      margin-bottom: 2rem;
       font-weight: 100;
       font-size: .7rem;
    }
    .text{
      margin-top: 1rem;
       font-weight: 100;
       font-size: .7rem;
    }
}
  /* CSS */
html,body {
  height: 100%;
  width: 100%;
  padding: 0;
  margin: 0;
}


*{
  user-select: none;
}

body{
  -webkit-app-region: drag;
}
</style>
